package com.k.suess;

import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @program: SpringSecote01
 * @ClassName MyForward
 * @description:
 * @author: xiaoJie
 * @create: 2024-09-11 20:36
 * @Version 1.0
 */
public class MyForward implements AuthenticationSuccessHandler {
    private String url;

    public MyForward(String url) {
        this.url = url;
    }

    @Override
    public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException {
        System.out.println("跳转");
        httpServletResponse.sendRedirect(url);
    }
}
